import { Component } from '@angular/core';

import { LiveShopService } from './live.shop.service';

import { LiveBase } from '../live.base';

import { Util } from '../../../utils/util';
import { Router } from '@angular/router';
@Component({
  selector: 'live-shop',
  templateUrl: './live.shop.html',
  styles: [`

  `],
  providers: [LiveShopService]
})

export class LiveShopComponent extends LiveBase {

  liver: any;

  constructor(public service: LiveShopService, private util: Util,private router: Router) {

    super(service);

    this.liver = this.util.sessionStore().get('liveDetail');

    this.param.darenId = this.liver.darenId;

    this.getHttp(this.param);
  }


  goShopHistory(_shopItem){

    this.util.sessionStore().set('liveShopHistory',_shopItem);

    this.router.navigate(['live',_shopItem['darenId'], _shopItem['uid']]);
  }

  getHttp(param) {

    var res = {"code":0,"msg":"成功","data":{"value":[{"id":"122343103\u0001263817957","date":"2017-11-22 00:00:00","uid":122343103,"nick":"伊米妮旗舰店","shopName":"伊米妮旗舰店","darenId":263817957,"sellAmount7Days":0,"sellMoney7Days":0.0,"productNum7Days":0,"sellAmount30Days":92,"sellMoney30Days":39021.0,"productNum30Days":4,"viewCount7Days":0,"praiseCount7Days":0,"viewCount30Days":161452,"praiseCount30Days":883075},{"id":"263817957\u0001263817957","date":"2017-11-22 00:00:00","uid":263817957,"nick":"韩都衣舍旗舰店","shopName":"韩都衣舍旗舰店","darenId":263817957,"sellAmount7Days":0,"sellMoney7Days":0.0,"productNum7Days":0,"sellAmount30Days":24080,"sellMoney30Days":6493311.0,"productNum30Days":65,"viewCount7Days":0,"praiseCount7Days":0,"viewCount30Days":315749,"praiseCount30Days":2155109},{"id":"467426552\u0001263817957","date":"2017-11-22 00:00:00","uid":467426552,"nick":"卓诗尼旗舰店","shopName":"卓诗尼旗舰店","darenId":263817957,"sellAmount7Days":0,"sellMoney7Days":0.0,"productNum7Days":0,"sellAmount30Days":1523,"sellMoney30Days":287096.0,"productNum30Days":2,"viewCount7Days":0,"praiseCount7Days":0,"viewCount30Days":75305,"praiseCount30Days":606574},{"id":"820351386\u0001263817957","date":"2017-11-22 00:00:00","uid":820351386,"nick":"土家硒泥坊旗舰店","shopName":"土家硒泥坊旗舰店","darenId":263817957,"sellAmount7Days":0,"sellMoney7Days":0.0,"productNum7Days":0,"sellAmount30Days":761,"sellMoney30Days":166659.0,"productNum30Days":1,"viewCount7Days":0,"praiseCount7Days":0,"viewCount30Days":75305,"praiseCount30Days":606574}],"count":4}};

    setTimeout(() => {

      this.vm.table.livers = res.data.value;

      this.vm.table.count = res.data.count;

    }, 100);
  }



}
